package com.example.yunJie.digitalSentry.mapper.one;


import com.example.yunJie.digitalSentry.entity.PeriodEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.io.Serializable;
import java.util.List;

public interface PeriodMapper {
//    @Insert("<script> insert into sz_period(mode,periodLength)\n" +
//            "        values(#{mode},#{periodLength})</script>")
    int insert(PeriodEntity periodEntity);

//    @Update("<script>update sz_period\n" +
//            "        <trim prefix=\"SET\" suffixOverrides=\",\">\n" +
//            "            <if test=\"mode != null\">mode = #{mode},</if>\n" +
//            "            <if test=\"periodLength != null\">periodLength = #{periodLength},</if>\n" +
//            "        </trim>\n" +
//            "        where id = #{id}</script>")
    int update(PeriodEntity periodEntity);

//    @Delete("<script>delete from sz_period where id = #{Id}</script>")
    int deleteById(Serializable id);

//    @Delete("<script> delete from sz_period where id in\n" +
//            "        <foreach collection=\"array\" item=\"id\" open=\"(\" separator=\",\" close=\")\">\n" +
//            "            #{id}\n" +
//            "        </foreach></script>")
    int deleteIdList(List<Integer> idList);

//    @Select("<script>select  *\n" +
//            "        from sz_period\n" +
//            "        <where>\n" +
//            "            <if test=\"id != null and id != ''\">id = #{id}</if>\n" +
//            "        </where></script>")
    PeriodEntity findId(String id);
//    @Select("<script>select * from sz_period\n" +
//            "        where mode = #{mode}</script>")
    PeriodEntity findByMode(String mode);

//    @Select("<script> select * from sz_period</script>")
    List<PeriodEntity> findAllByPeriod(PeriodEntity periodEntity);
//    @Select("<script> select * from sz_period</script>")
    List<PeriodEntity> findAll();


}
